const sum = require('./sum');

const arrUtil = require('./arr-utils');

// 导入第三方模块
const uniq = require('uniq');

let arr = [6,7,8];

console.log(sum(arr)); //21

console.log(arrUtil.average(arr)); //7

console.log(arrUtil.getMax(arr)); //8

// console.log(uniq); //[Function: unique]

let arr2 = [1,2,3,4,2,3,3,3,1];

// 数组去重
console.log(uniq(arr2)); //[ 1, 2, 3, 4 ]

// document is not defined
// window
document.querySelector('button').onclick = function(){
    // alert(1);

    // 写法1
    // 随机数 0-1 永远不等于1
    // let rndNum = Math.random()*100;
    // // 向下取整
    // let num = Math.floor(rndNum);


    // 写法2
    let rndNum = Math.floor(Math.random()*100);


    console.log('随机中奖号码'+rndNum);

};



